#ifndef _MYTASK_H
#define _MYTASK_H

#include "task.h"

enum SubTaskType
{
    SUBTASK_TYPE_FINDMAP,
    SUBTASK_TYPE_KILLMONSTER,
};

enum EventType
{
    CLICK_NPC,
    ENTER_MAP,
    ///and so on
};

//one subtask type
class FindMapSubTask : public SuperSubTaskHandler
{
private:
    struct FindMapSubTaskData
    {
        int	mapid;
        int	findid;
    };
public:
protected:
    virtual	bool	isComplete(const SubTask& aSubTask)
    {
        const FindMapSubTaskData& RealData = conversion<FindMapSubTaskData>(aSubTask);
        return RealData.mapid == RealData.findid;
    }
    virtual	void	onSubmitTask()
    {
    }

    virtual	void	updateData(SubTask& aSubTask, int EventID, void* aArg)
    {
        if (EventID == ENTER_MAP)
        {
            FindMapSubTaskData& RealData = conversion<FindMapSubTaskData>(aSubTask);

            if (RealData.mapid == 0)
            {
                RealData.mapid = *(int*)aArg;
            }
        }
    }

};
extern FindMapSubTask g_findMapSubTaskHandler;

enum TaskType
{
    DAILY_TASK
};

//one task type
class DailyTask : public SuperTaskHandler
{
private:
    virtual	bool	isComplete(const Task& aTask)
    {
        return aTask.isComplete();
    }

    virtual	void	onSubmitTask()
    {
        //what do this? you want.
    }
};

extern DailyTask g_dailyTaskHandler;

void	updateTaskOnEnterMap(Task&, int aMapID);
#endif
